﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common
{
    public class Documentation: Item
    {
        public int ID { get; set; }
        //Номер
        public string ISBN { get; set; }
        //Назва документа за класифікатором
        public string TypeDocument { get; set; }
        //Автор
        public string AuthorName { get; set; }
        //Дата перегляду документа
        public DateTime Date_1 { get; set; }
        //Дата затвердженя
        public DateTime Date_2 { get; set; }
        //Стисла інформація
        public string Information { get; set; }
        //Згідно документа
        public string AccorDocument { get; set; }
        //Затвержений керівником
        public string Approved { get; set; }
        //Номенклатурный номер соответствующий документу (норми,правила, ДБН)
        public string Resourcse { get; set; }
        //
        public string ScanDoc { get; set; }
        //
        public string WorldExcelDoc { get; set; }
        //
        public string FileExsten { get; set; }

        public Dictionary<string, string> ItemFields { get; private set; }
        public Dictionary<string, string> AuthorFields { get; private set; }
        public Dictionary<string, string> DocumentationkFields { get; private set; }
        public Dictionary<string, string> RefDocumentationkFields { get; private set; }

        public Documentation() {}

        public Documentation(string name, string publisher, DateTime publishedDate , string isbn, string authorename) 
            :this(name, publisher, publishedDate, isbn, authorename, DateTime.MinValue, DateTime.MinValue) { }

        public Documentation(string name, string publisher, DateTime publishedDate, string isbn, string authorename, DateTime date_1, DateTime date_2)
            : this(name, publisher, publishedDate, isbn, authorename, date_1, date_2, string.Empty, string.Empty, string.Empty) { }

        public Documentation(string name, string publisher, DateTime publishedDate, string isbn, string authorename, DateTime date_1, DateTime date_2, string information, string accordocument, string approved)
            : this(0, name, publisher, publishedDate, isbn, authorename, date_1, date_2, string.Empty, string.Empty, string.Empty, string.Empty) { }

        public Documentation(int id, string name, string publisher, DateTime publishedDate, string isbn, string authorename, DateTime date_1, DateTime date_2, string information, string accordocument, string approved, string resourse)
            : this(id, name, publisher, publishedDate, isbn, authorename, date_1, date_2, information, accordocument, approved, resourse, string.Empty, string.Empty, string.Empty,string.Empty) { }

        public Documentation( int id, string name, string publisher, DateTime publishedDate, string isbn, string authorename,DateTime date_1, DateTime date_2, string information, string accordocument, string approved, string resourse, string scandoc, string worldexceldoc, string fileexsten, string typedocument)
        {
            this.ID = id;
            this.Name = name;
            this.Publisher = publisher;
            this.PublishedDate = publishedDate;
            this.ISBN = isbn;
            this.AuthorName = authorename;
            this.Date_1 = date_1;
            this.Date_2 = date_2;
            this.Information = information;
            this.AccorDocument = accordocument;
            this.Approved = approved;
            this.Resourcse = resourse;
            this.ScanDoc = scandoc;
            this.WorldExcelDoc = worldexceldoc;
            this.FileExsten = fileexsten;
            this.TypeDocument = typedocument;

            ItemFields = new Dictionary<string, string>(3);
            ItemFields.Add("Name", Name);
            ItemFields.Add("Publisher", Publisher);
            ItemFields.Add("PublishedDate", PublishedDate.Date.ToString());

            AuthorFields = new Dictionary<string, string>(1);
            AuthorFields.Add("Name", AuthorName);

            DocumentationkFields = new Dictionary<string, string>(11);
            DocumentationkFields.Add("ISBN", ISBN);
            DocumentationkFields.Add("Date_1", Date_1.ToString());
            DocumentationkFields.Add("Date_2", Date_2.ToString());
            DocumentationkFields.Add("information", Information);
            DocumentationkFields.Add("AccorDocument", AccorDocument);
            DocumentationkFields.Add("Approved", Approved);
            DocumentationkFields.Add("Resourse", Resourcse);
            DocumentationkFields.Add("ScanDoc", ScanDoc);
            DocumentationkFields.Add("WorldExcelDoc", WorldExcelDoc);
            DocumentationkFields.Add("FileExsten", FileExsten);
            DocumentationkFields.Add("TypeDocument", TypeDocument);

            RefDocumentationkFields = new Dictionary<string, string>(1);
            RefDocumentationkFields.Add("TypeDocument", TypeDocument);
        }

    }
}
